/**
 * Created by baijs on 2016/7/28.
 */

;!function (win) {
    "use strict";

    win.CheckUtil = {
        /**
         * 正则校验 手机号
         * 13[0-9], 14[5,7], 15[0, 1, 2, 3, 5, 6, 7, 8, 9], 17[6, 7, 8], 18[0-9], 170[0-9],171[8,9]
         * 移动号段: 134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705
         * 联通号段: 130,131,132,155,156,185,186,145,176,1709,1718,1719
         * 电信号段: 133,153,180,181,189,177,1700
         * @param phoneNum 待验证手机号
         * @param fn 回调函数
         * @returns {Boolean}
         */
        phoneNumCheck: function (phoneNum,callback) {
            var isOk = false;
            if ((/^(0|86|17951)?(13[0-9]|15[012356789]|17[01678]|18[0-9]|14[57])[0-9]{8}$/
                    .test(phoneNum))) {
                isOk =  true;
            } else {
                isOk = false;
            }
            if(typeof callback == 'function'){
                callback(isOk);
            }
            return isOk;

        },
        telNumCheck: function(telNum,callback){
            var isOk = false;
            if ((/^((0\d{2,3}\d{7,8}))$/
                    .test(phoneNum))) {
                isOk =  true;
            } else {
                isOk = false;
            }
            if(typeof callback == 'function'){
                callback(isOk);
            }
            return isOk;
        }
    }

}(window);


